﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Text.RegularExpressions;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string test = "\\@abc a";
            string test2 = "@abc";
            Regex regex = new Regex(@"(?<=@)abc(?<=@)");
            string aa = regex.Match(test).Value;
            aa = regex.Match(test2).Value;

            
            Random r = new Random();
            //for (int i = 0; i < numbers.Length; i++)
            //    numbers[i] = r.Next();
            //List<int> li = new List<int>(numbers);

            Stopwatch sw = Stopwatch.StartNew();
            //for (int i = 0; i < 100; i++)
            //{
            //    //li.Sort();
            //    Sort(numbers);
            //}
            sw.Stop();
            Console.WriteLine(sw.Elapsed.TotalSeconds);
        }

        public static void Sort(int[] numbers)
        {
            Sort(numbers, 0, numbers.Length - 1);
        }
 
        private static void Sort(int[] numbers, int left, int right)
        {
            if (left < right)
            {
                int middle = numbers[(left + right) / 2];
                int i = left - 1;
                int j = right + 1;
                while (true)
                {
                    while (numbers[++i] < middle) ;
 
                    while (numbers[--j] > middle) ;
 
                    if (i >= j)
                        break;
 
                    Swap(numbers, i, j);
                }
 
                Sort(numbers, left, i - 1);
                Sort(numbers, j + 1, right);
            }
        }
 
        private static void Swap(int[] numbers, int i, int j)
        {
            int number = numbers[i];
            numbers[i] = numbers[j];
            numbers[j] = number;
        }
    }
}
